home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 20
/
Cream of the Crop 20 (Terry Blount) (1996).iso
/
doom
/
cddk9605.zip
/
HEADERS.ARJ
/
SCRIPTS.INT
< prev
next >
Wrap
Text File
|
1996-05-17
|
5KB
|
169 lines
{ ───────────────────────────────────────────────────────────────────────── }
{ Name : SCRIPTS.PAS }
{ Description : Script Interpreter }
{ ───────────────────────────────────────────────────────────────────────── }
UNIT Scripts;
{$B-} { . . . . . . . . . . . . . . . . . . . . Shortcut boolean evaluation }
{$F+} { . . . . . . . . . . . . . . . . . . . . Force far calls for safety }
{$I-} { . . . . . . . . . . . . . . . . . . . Disable input/output checking }
{$O+} { . . . . . . . . . . . . . . . . . . Allow this unit to be overlayed }
{$Q-} { . . . . . . . . . . . . . . Do not generate overflow-checking code }
{$R-} { . . . . . . . . . . . . . . . . Do not generate range-checking code }
{$S-} { . . . . . . . . . . . . . . . . Do not generate stack-checking code }
{$X+} { . . . . . . . . . . . Extended syntax for pChars and function calls }
INTERFACE
USES
Objects;
CONST
{ Identifier types }
_Unknown = $00; { . . . . Unknown type or reserved identifier name }
_Function = $01; { . . . . . . . . . . . Programmer-defined function }
_Label = $02; { . . . . . . . . . . . . . Reserved for future use }
_Variable = $03; { . . . . . . . . . . . Programmer-defined variable }
_Status = $04; { . . . . . . . . . . . . Reserved for status lines }
_Menu = $05; { . . . . . . . . . . . . . . . Reserved for menus }
TYPE
tID = OBJECT(tObject)
NameStr : pChar; { . . . . . . . . . . . . The name of the identifier }
NameCRC : LongInt; { . . . . . . . . . . . . The 32-bit CRC of its name }
Family : Word; { . . . The family of the identifier (i.e. variable) }
CONSTRUCTOR Init(p:pChar; k:Word);
DESTRUCTOR Done; VIRTUAL;
END;
pID = ^tID;
tParams = OBJECT(tCollection)
PROCEDURE FreeItem(Item:Pointer); VIRTUAL;
PROCEDURE InsertString(p:pChar); VIRTUAL;
END;
pParams = ^tParams;
tFunction = OBJECT(tID)
Handler : PROCEDURE(p:pParams);
Params : Byte;
CONSTRUCTOR Init(p:pChar; HandlerPtr:Pointer; Count:Byte);
END;
pFunction = ^tFunction;
tVariable = OBJECT(tID)
Address : Pointer;
ReadOnly : Boolean;
CONSTRUCTOR Init(p:pChar; Addr:Pointer);
PROCEDURE Assign(p:pChar); VIRTUAL;
FUNCTION Obtain:STRING; VIRTUAL;
END;
pVariable = ^tVariable;
CONST
IDs : pCollection = NIL;
ScriptDir : pChar = NIL;
PROCEDURE DeleteID(p:pChar);
{
PURPOSE : Deletes the identifier.
NOTES : The name of the identifier is not case-sensitive.
}
FUNCTION Execute(Source:pChar):Word;
{
PURPOSE : Interpreters the string of commands.
SEE ALSO : Script
}
FUNCTION Let(Variable,Equal:pChar):Boolean;
{
PURPOSE : Assigns a value to the specified variable.
RETURNS : TRUE if the operation was successful, FALSE if not. The
operation will fail if the specified variable is read-only
or does not exist.
}
PROCEDURE MakeReadOnly(Variable:pChar);
{
PURPOSE : Makes a variable read-only. A read-only variable cannot be
modified by the sysop.
EXAMPLE : PROCEDURE Protect_Software;
BEGIN
MakeReadOnly('Author');
MakeReadOnly('Copyright');
MakeReadOnly('Version');
END;
}
PROCEDURE Parse(p:pChar; VAR Index,Length,Next:Word);
{
PURPOSE : Parses a token in a string.
PARAMS : p The string to parse.
Index The starting position of the parser. Upon return
this variable contains the starting position of
the next token.
Length The length of the token.
Next The suggested starting position of the next Parse call.
}
PROCEDURE RegisterFunction(Name:pChar; Addr:Pointer; Count:Byte);
{
PURPOSE : Registers a function with the script interpreter.
PARAMS : Name The name of the function (not case-sensitive).
Addr The address of the function handler.
Count The number of parameters to send to the handler.
NOTES : A function handler is declared as follows:
PROCEDURE <NAME>(<POINTER>:pParams);
Where <NAME> is the name of the handler, and <POINTER>
is the name of a tParams pointer. The handler must use
any other parameters; this will cause memory stack problems.
}
FUNCTION Script(p:pChar):Word;
{
PURPOSE : Executes a script file.
NOTES : The ScriptDir string is used instead of any specified path,
if ScriptDir is not NIL.
SEE ALSO : Execute
}
FUNCTION SearchFor(p:pChar):pID;
{
PURPOSE : Scans the list of identifiers stored in IDs and returns a
pointer if the specified name exists.
}